package com.demo.designmode.reponseibility.case2;

/**
 * @author jiaxXM
 * @date 2024/9/19
 */
public class Client {

    public static void main(String[] args) {

        //创建请求
        String data = "肉蛋葱鸡水果蔬菜千层饼雅俗共赏第五层的马老师";
        Request request = new Request();
        request.setData(data);
        //创建FilterChain执行链
        FilterChain filterChain = new FilterChain();
        //添加过滤器
        filterChain.addFilter(new FruitsFilter());
        filterChain.addFilter(new VegetablesFilter());

        //执行预处理
        String s = filterChain.preHandleRequest(request.getData());

        request.setData(s);
        //打印结果，验证
        System.out.println(request.getData());//下面是打印结果，肉蛋葱鸡千层饼雅俗共赏第五层的马老师

    }
}
